from random import randint
from graph import *
H = 200
W = 200
brushColor("yellow")
rectangle(0, 0, H, W)
brushColor("green")
x_a = -20
y_a = 20
x_b = 20
y_b = -20
x_a1 = x_a + W//2
y_a1 = -y_a + H//2
x_b1 = x_b + W//2
y_b1 = -y_b + H//2
rectangle(x_a1, y_a1, x_b1, y_b1)
n = int(input('Введите количество выстрелов: '))
penSize (1)
penColor("red")
brushColor("red")
k = 0
for i in range(n):
         x = randint(-W//2, W//2)
         y = -randint(-H//2, H //2)
         x_e = x + W//2
         y_e = -y + H//2
         circle(x_e,y_e,1)
         if x >= x_a and x <= x_b and y <= y_a and y >= y_b :
             k += 1
             print("Количество выстрелов:",n)
             print("Количетсво попаданий:",k)
run()
